<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.Statement"  %>
<%@page import="com.huqiwen.table.DataSource"%>
<%@page import="java.sql.ResultSet"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%
    String sql = "select * from tabletest order by orders";
    Statement stmt = DataSource.getConnection().createStatement();
    ResultSet rs = stmt.executeQuery(sql);
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script  type="text/javascript" src="js/jquery.js"></script>
        <script type="text/javascript" src="js/jquery.tablesorter.js"></script>
        <script type="text/javascript" src="js/jquery.tablednd_0_5.js"></script>
        <script type="text/javascript">
        $(document).ready(function() {
            // Initialise the table
            $("#table").tableDnD({
            	onDrop: function(table, row) {
        			var mystr = $.tableDnD.serialize();
        			alert(mystr);
                    $.post("TabelOrder",{str:mystr},function(test){
							alert("return:"+test);
                        });
                }
            	});
        });
        </script>
    </head>
    <body>
        <h1>表格拖动示例</h1>
        <table id="table" cellspacing="0" cellpadding="2" border="1">        
 		<%while(rs.next()){ %>
 	
        <tr id="<%=rs.getString("id")%>">
        	<td><%=rs.getString("username")%></td><td><%=rs.getString("password")%></td><td><%=rs.getString("email")%></td>
        </tr>	
        <!-- 
        <tr id="2"><td>2</td><td>ddf</td><td>dfd</td></tr>	
        -->
 		<%} %>
  
        </table>
    </body>
</html>
